<?php
use yii\helpers\Url;
use yii\helpers\Html;
$main     = \backend\modules\models\setting\Menu::findOne(['name' => '新闻中心', 'parent_id' => 0]);
$main_top = $main->getAllContents(2);
?>

<div class="col-md-6 col-lg-6" style="padding-left:0">
    <div id="carouselExampleCaptions" class="carousel slide" data-ride="carousel" data-interval="false">
        <ol class="carousel-indicators">
            <?php if ($main_top) {?>
                <?php foreach ($main_top as $one => $first): ?>
                    <?php if ($one == 0) {?>
                        <li data-target="#carouselExampleCaptions" data-slide-to="<?= Html::encode($one)?>" class="active"></li>
                    <?php }else {?>
                        <li data-target="#carouselExampleCaptions" data-slide-to="<?= Html::encode($one)?>"></li>
                    <?php }?>
                <?php endforeach ?>
            <?php }?>
        </ol>
        <div class="carousel-inner">
            <?php if ($main_top) {?>
                <?php foreach ($main_top as $one => $first): ?>
                    <?php if ($one == 0) {?>
                        <div class="carousel-item active">
                    <?php }else {?>
                        <div class="carousel-item">
                    <?php }?>
                    <img src="<?= Html::encode($first->image)?>" class="d-block w-100" alt="<?= Html::encode($first->resume)?>">
                        <div class="carousel-caption d-md-block">
                            <a href="<?= Url::to(['site/content','content_id'=>$first->id])?>"><?= Html::encode($first->title)?></a>
                        </div>
                    </div>
                <?php endforeach ?>
            <?php }?>
        </div>
    </div>
</div>